<template>
	<view>
		<uni-popup @change="exitChange" ref="kk" :mask-click="false" class="ppphhh" mode="center">
			<view class="bgfff ra30 width880 posire pt50 pb50">
				<image @click="$refs.kk.close()" mode="widthFix" class="image posiab right30 top20 width50" src="/static/img/bi.png"></image>
				<view class="size36 color333 bold flex-a-i ml50 mb60">
					<image mode="widthFix" class="image width50 mr15"  src="/static/img/tishi.png"></image>{{title}}
				</view>
				<view class="flex-row mr60">
					<view class="flex-a-i ">
						<view v-if="isclen" @click="$refs.kk.close()" class="wh152-64 borderd0d6dc flex-ju-c ra5">取消</view>
						<view @click="confirm" :style="{background:bgcolor}" class="wh152-64 colorfff flex-ju-c ml60 ra5">确定</view>
					</view>
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	export default {
		name:"tishi",
		props:['title','isclen','bgcolor','isexit','logout'],
		data() {
			return {
				isexitclose:false
			};
		},
		created() {
			// uni.$on('exitclose',res=>{
			// 	this.isexitclose = true
			// })
		},
		watch:{
		},
		computed:{
			
		},
		methods:{
			confirm(){
				if(this.isexit==1){
					//是否取消预约
					this.$emit('confirm')
					this.close()
					return
				}
				
				if(this.logout==1){
					uni.reLaunch({
						url:"/pages/index/login"
					})
				}
				 
				this.http('/logout', {}, 'post').then(res => {
					uni.setStorageSync("token", '')
					uni.setStorageSync("user", '')
					uni.setStorageSync("info", '')
					uni.setStorageSync("sdkinfo", '')
					
					// if(this.isexitclose){
					// 	window.flutter_inappwebview.callHandler('close').then(function(result) {
					// 	})
					// 	return
					// }
					
					loginMgr.logout('手动').then(res=>{
					})
					loginMgr.put_self_status('0')
					uni.reLaunch({
						url:"/pages/index/login"
					})
					
				})
			
			},
			show(){
				this.$refs.kk.open()
			},
			close(){
				this.$refs.kk.close()
				
			},
			exitChange(e){
				if(!e.show){
					this.$emit('exitChange')
				}
			}
		}
	}
</script>

<style>

</style>